package com.example.consumer.mq;

import com.example.consumer.utils.DateTimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

/**
 * 消费者
 */
@Component
public class Consumer {

    @Autowired
    private FeedBackProducer feedBackProducer;

    @JmsListener(destination = "${sendqueue}")
    public void receive(String msg) {
        System.out.println("下发收到:" + msg);
        try {
            Thread.sleep(1000 * 60);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("下发处理结束时间：" + DateTimeUtil.getCurrentDateTime());
        //处理结束发送反馈
        feedBackProducer.feedback();
    }
}
